#include<stdio.h>
int main()
{
    //freopen("in.txt","r",stdin);
    int x[6];
    for(int i = 0; i < 6 ; i++)
    {
        scanf("%d",&x[i]);
    }
    int ans = 1;
    int right = 3;
    char c;
    while (scanf("%c",&c) != EOF)
    {
        // printf("%c %d\n",c,ans);
        if(c == 'E')
        {
            if(ans == 1)
            {
                if(right == 2) ans = 5;
                else
                if(right == 3) ans = 4;
                else
                if(right == 4) ans = 3;
                else ans = 2;
                right = 1;
            }
            else
            if(ans == 2)
            {
                // right = 2;
                if(right == 1) ans = 6;
                else
                if(right == 3) ans = 4;
                else
                if(right == 4) ans = 3;
                else ans = 1;
                right = 2;
            }
            else
            if(ans == 3)
            {
                // right = 3;
                if(right == 1) ans = 6;
                else
                if(right == 6) ans = 1;
                else
                if(right == 2) ans = 5;
                else ans = 2;
                right = 3;
            }
            else
            if(ans == 4)
            {
                // right = 4;
                if(right == 1) ans = 6;
                else
                if(right == 6) ans = 1;
                else
                if(right == 2) ans = 5;
                else ans = 2;
                right = 4;
            }
            else
            if(ans == 5)
            {
                // right = 5;
                if(right == 1) ans = 6;
                else
                if(right == 3) ans = 4;
                else
                if(right == 4) ans = 3;
                else ans = 1;
                right = 5;
            }
            else
            if(ans == 6)
            {
                // right = 6;
                if(right == 2) ans = 5;
                else
                if(right == 3) ans = 4;
                else
                if(right == 4) ans = 3;
                else ans = 2;
                right = 6;
            }
        }
        if(c == 'S')
        {
            if(ans == 1)
            {
                if(right == 2) ans = 3;
                else
                if(right == 3) ans = 5;
                else
                if(right == 4) ans = 2;
                else ans = 4;
            }
            else
            if(ans == 2)
            {
                if(right == 1) ans = 4;
                else
                if(right == 3) ans = 1;
                else
                if(right == 4) ans = 6;
                else ans = 3;
            }
            else
            if(ans == 3)
            {
                if(right == 1) ans = 2;
                else
                if(right == 6) ans = 5;
                else
                if(right == 2) ans = 6;
                else ans = 1;
            }
            else
            if(ans == 4)
            {
                if(right == 1) ans = 5;
                else
                if(right == 6) ans = 2;
                else
                if(right == 2) ans = 1;
                else ans = 6;
            }
            else
            if(ans == 5)
            {
                if(right == 1) ans = 3;
                else
                if(right == 3) ans = 6;
                else
                if(right == 4) ans = 1;
                else ans = 4;
            }
            else
            if(ans == 6)
            {
                if(right == 2) ans = 4;
                else
                if(right == 3) ans = 2;
                else
                if(right == 4) ans = 5;
                else ans = 3;
            }
        }
        if(c == 'W')
        {
            if(ans == 1)
            {
                ans = right;
                right = 6;
            }
            else
            if(ans == 2)
            {
                ans = right;
                right = 5;
            }
            else
            if(ans == 3)
            {
                ans = right;
                right = 4;
            }
            else
            if(ans == 4)
            {
                ans = right;
                right = 3;
            }
            else
            if(ans == 5)
            {
                ans = right;
                right = 2;
            }
            else
            if(ans == 6)
            {
                ans = right;
                right = 1;
            }
        }
        if(c == 'N')
        {
            if(ans == 1)
            {
                if(right == 2) ans = 4;
                else
                if(right == 3) ans = 2;
                else
                if(right == 4) ans = 5;
                else ans = 3;
            }
            else
            if(ans == 2)
            {
                if(right == 1) ans = 3;
                else
                if(right == 3) ans = 6;
                else
                if(right == 4) ans = 1;
                else ans = 4;
            }
            else
            if(ans == 3)
            {
                if(right == 1) ans = 5;
                else
                if(right == 6) ans = 2;
                else
                if(right == 2) ans = 1;
                else ans = 6;
            }
            else
            if(ans == 4)
            {
                if(right == 1) ans = 2;
                else
                if(right == 6) ans = 5;
                else
                if(right == 2) ans = 6;
                else ans = 1;
            }
            else
            if(ans == 5)
            {
                if(right == 1) ans = 4;
                else
                if(right == 3) ans = 1;
                else
                if(right == 4) ans = 6;
                else ans = 3;
            }
            else
            if(ans == 6)
            {
                if(right == 2) ans = 3;
                else
                if(right == 3) ans = 5;
                else
                if(right == 4) ans = 2;
                else ans = 4;
            }
        }
        // printf("%d %d\n",ans,right);
    }
    //printf("%d\n",ans);
    printf("%d",x[ans-1]);
}